package online.shenme.day14_self.domin;

import java.time.LocalTime;

public class Subway {
    @java.io.Serial
    private static final long serialVersionUID = 2L;
    private String code;
    private String name;
    private String belong;
    private int stayMinute;
    private LocalTime begTime;
    private LocalTime endTime;


    public Subway() {
    }

    public Subway(String code, String name, String belong) {
        this.code = code;
        this.name = name;
        this.belong = belong;
    }

    public Subway(String code, String name, String belong, int stayMinute, LocalTime begTime, LocalTime endTime) {
        this.code = code;
        this.name = name;
        this.belong = belong;
        this.stayMinute = stayMinute;
        this.begTime = begTime;
        this.endTime = endTime;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getBelong() {
        return belong;
    }

    public void setBelong(String belong) {
        this.belong = belong;
    }

    public int getStayMinute() {
        return stayMinute;
    }

    public void setStayMinute(int stayMinute) {
        this.stayMinute = stayMinute;
    }

    public LocalTime getBegTime() {
        return begTime;
    }

    public void setBegTime(LocalTime begTime) {
        this.begTime = begTime;
    }

    public LocalTime getEndTime() {
        return endTime;
    }

    public void setEndTime(LocalTime endTime) {
        this.endTime = endTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Subway subway = (Subway) o;

        if (stayMinute != subway.stayMinute) return false;
        if (code != null ? !code.equals(subway.code) : subway.code != null) return false;
        if (name != null ? !name.equals(subway.name) : subway.name != null) return false;
        if (belong != null ? !belong.equals(subway.belong) : subway.belong != null) return false;
        if (begTime != null ? !begTime.equals(subway.begTime) : subway.begTime != null) return false;
        return endTime != null ? endTime.equals(subway.endTime) : subway.endTime == null;
    }

    @Override
    public int hashCode() {
        int result = code != null ? code.hashCode() : 0;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (belong != null ? belong.hashCode() : 0);
        result = 31 * result + stayMinute;
        result = 31 * result + (begTime != null ? begTime.hashCode() : 0);
        result = 31 * result + (endTime != null ? endTime.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return  "地铁站编号=" + code +
                ",地铁站名称=" + name +
                ", 地铁站归属=" + belong +
                ", 停留时间=" + stayMinute +
                ", 起发时间=" + begTime +
                ", 终止时间=" + endTime;
    }
}
